package com.matt.repository.teaching;

import com.matt.domain.teaching.CourseOfficial;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/1/23
 * *******************************
 */
public interface CourseOfficialRepository extends JpaRepository<CourseOfficial, String>, JpaSpecificationExecutor<CourseOfficial> {
    CourseOfficial findByNameAndTypeNameAndDeleted(String name, String typeName, Boolean deleted);

    CourseOfficial findByVideoUrlLike(String videoUrl);

    List<CourseOfficial> findByTypeNameAndDeletedAndStatus(String typeName, Boolean deleted, Integer status);

    List<CourseOfficial> findByTypeNameAndDeletedOrderByTypeCodeDesc(String typeName, Boolean deleted);

    CourseOfficial findTop1ByOrderByTypeCodeDesc();
}
